export class Log {
  id?: number;
  username = '';
  operation = '';
  method = '';
  params = '';
  time?: number;
  ip = '';
  createDate = '';

  constructor(data?: Log) {
    data && this.setProps(data);
  }

  setProps(data: Log) {
    (Object.keys(this) as Array<keyof ILog>).forEach((key) => {
      // @ts-ignore
      this[key] = data[key]
    })
  }
}

export type ILog = Omit<Log, 'setProps'>